import request from '@/utils/request'
import { downFile } from '@/utils/request'
import { praseStrEmpty } from '@/utils/ruoyi'

/**
 * 不良原因分页查询
 * @param {查询条件} data
 */
export function listbaseDefectitem(query) {
	return request({
		url: 'base/baseDefectitem/list',
		method: 'get',
		params: query,
	})
}

/**
 * 新增不良原因
 * @param data
 */
export function addbaseDefectitem(data) {
	return request({
		url: 'base/baseDefectitem',
		method: 'post',
		data: data,
	})
}
/**
 * 修改不良原因
 * @param data
 */
export function updatebaseDefectitem(data) {
	return request({
		url: 'base/baseDefectitem',
		method: 'PUT',
		data: data,
	})
}
/**
 * 获取不良原因详情
 * @param {Id}
 */
export function getbaseDefectitem(id) {
	return request({
		url: 'base/baseDefectitem/' + id,
		method: 'get'
	})
}

/**
 * 删除不良原因
 * @param {主键} pid
 */
export function delbaseDefectitem(pid) {
	return request({
		url: 'base/baseDefectitem/delete/' + pid,
		method: 'POST'
	})
}
// 导出不良原因
export async function exportbaseDefectitem(query) {
	await downFile('base/baseDefectitem/export', { ...query })
}
